Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadMaskPart=function(){this.value="";
this.index=-1;
this.type=-1;
this.PromptChar="_";
};
Telerik.Web.UI.RadMaskPart.prototype={HandleKey:function(a){return false;
},HandleWheel:function(a){return true;
},SetController:function(a){this.controller=a;
},GetValue:function(){return this.value.toString();
},GetVisValue:function(){return"";
},SetValue:function(a,b){return true;
},CanHandle:function(a,b){return true;
},IsCaseSensitive:function(){return false;
},GetLength:function(){return 1;
},IsAlpha:function(a){return a.match(/[^\u005D\u005B\t\n\r\f\s\v\\!-@|^_`{-\u00BF]{1}/)!=null;
}};
Telerik.Web.UI.RadMaskPart.registerClass("Telerik.Web.UI.RadMaskPart");
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadDigitMaskPart=function(){Telerik.Web.UI.RadDigitMaskPart.initializeBase(this);
};
Telerik.Web.UI.RadDigitMaskPart.prototype={GetValue:function(){return this.value.toString();
},IsCaseSensitive:function(){return true;
},GetVisValue:function(){if(this.value.toString()==""){return this.PromptChar;
}return this.value.toString();
},CanHandle:function(a,b){if(isNaN(parseInt(a))){this.controller._OnChunkError(this,this.GetValue(),a);
return false;
}return true;
},SetValue:function(a,b){if(a==""||a==this.PromptChar||a==" "){this.value="";
return true;
}if(this.CanHandle(a,b)){this.value=parseInt(a);
}return true;
}};
Telerik.Web.UI.RadDigitMaskPart.registerClass("Telerik.Web.UI.RadDigitMaskPart",Telerik.Web.UI.RadMaskPart);
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadEnumerationMaskPart=function(a){Telerik.Web.UI.RadEnumerationMaskPart.initializeBase(this);
this.SetOptions(a);
this.lastOffsetPunched=-1;
this.selectedForCompletion=0;
this.FlipDirection=0;
this.RebuildKeyBuff();
};
Telerik.Web.UI.RadEnumerationMaskPart.prototype={SetOptions:function(a){this.length=0;
this.Options=a;
this.optionsIndex=[];
for(var b=0;
b<this.Options.length;
b++){this.length=Math.max(this.length,this.Options[b].length);
this.optionsIndex[this.Options[b]]=b;
}},CanHandle:function(){return true;
},SetController:function(a){this.controller=a;
this.InitializeSelection(a.get_allowEmptyEnumerations());
},InitializeSelection:function(a){if(a){this.value="";
this.selectedIndex=-1;
}else{this.value=this.Options[0];
this.selectedIndex=0;
}},RebuildKeyBuff:function(){this.keyBuff=[];
for(i=0;
i<this.length;
i++){this.keyBuff[i]="";
}this.keyBuffRebuilt=true;
},IsCaseSensitive:function(){return true;
},ResetCompletion:function(){this.selectedForCompetion=0;
},SelectNextCompletion:function(){this.selectedForCompletion++;
},Store:function(a,b){if(this.lastOffsetPunched==b){if(this.keyBuff[b]==a){this.SelectNextCompletion();
}else{this.RebuildKeyBuff();
}}else{this.ResetCompletion();
}this.lastOffsetPunched=b;
this.keyBuff[b]=a;
},SetNoCompletionValue:function(){if(this.controller.get_allowEmptyEnumerations()){this.SetOption(-1);
}},SetValue:function(a,d){d-=this.offset;
this.Store(a,d);
var b=new Telerik.Web.UI.CompletionList(this.Options,this.PromptChar);
var e=b.GetCompletions(this.keyBuff,d);
if(e.length>0){var c=this.optionsIndex[e[this.selectedForCompletion%e.length]];
this.SetOption(c);
}else{this.SetNoCompletionValue();
return false;
}return true;
},GetVisValue:function(){var a=this.value;
while(a.length<this.length){a+=this.PromptChar;
}return a;
},GetLength:function(){return this.length;
},GetSelectedIndex:function(){return this.selectedIndex;
},SetOption:function(c,a){var b=this.value;
if(this.controller.get_allowEmptyEnumerations()){if(c<-1){c=this.Options.length+c+1;
this.FlipDirection=-1;
}else{if(c>=this.Options.length){c=c-this.Options.length-1;
this.FlipDirection=1;
}}}else{if(c<0){c=this.Options.length+c;
this.FlipDirection=-1;
}else{if(c>=this.Options.length){c=c-this.Options.length;
this.FlipDirection=1;
}}}this.selectedIndex=c;
this.value=c==-1?"":this.Options[c];
if(typeof(a)!="undefined"){if(a){this.controller._OnMoveUp(this,b,this.value);
}else{this.controller._OnMoveDown(this,b,this.value);
}}this.controller._OnEnumChanged(this,b,this.value);
this.FlipDirection=0;
},HandleKey:function(b){this.controller._calculateSelection();
var a=new Telerik.Web.UI.MaskedEventWrap(b,this.controller._textBoxElement);
if(a.IsDownArrow()){this.SetOption(this.selectedIndex+1,false);
this.controller._Visualise();
this.controller._FixSelection(a);
return true;
}else{if(a.IsUpArrow()){this.SetOption(this.selectedIndex-1,true);
this.controller._Visualise();
this.controller._FixSelection(a);
return true;
}}},HandleWheel:function(b){this.controller._calculateSelection();
var a=new Telerik.Web.UI.MaskedEventWrap(b,this.controller._textBoxElement);
this.SetOption(this.selectedIndex-b.rawEvent.wheelDelta/120);
this.controller._Visualise();
this.controller._FixSelection(a);
return false;
}};
Telerik.Web.UI.RadEnumerationMaskPart.registerClass("Telerik.Web.UI.RadEnumerationMaskPart",Telerik.Web.UI.RadMaskPart);
Telerik.Web.UI.CompletionList=function(b,a){this.options=b;
this.blankChar=a;
};
Telerik.Web.UI.CompletionList.prototype={GetCompletions:function(c,d){var b=this.options;
for(var a=0;
a<=d;
a++){var e=c[a].toLowerCase();
b=this.FilterCompletions(b,a,e);
}return b;
},FilterCompletions:function(a,f,b){var c=[];
for(var d=0;
d<a.length;
d++){var g=a[d];
var e=g.charAt(f).toLowerCase();
if(this.CharacterMatchesCompletion(b,e)){c[c.length]=g;
}}return c;
},CharacterMatchesCompletion:function(b,a){return b==this.blankChar||b==" "||b==a;
}};
Telerik.Web.UI.CompletionList.registerClass("Telerik.Web.UI.CompletionList");
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadFreeMaskPart=function(){Telerik.Web.UI.RadFreeMaskPart.initializeBase(this);
};
Telerik.Web.UI.RadFreeMaskPart.prototype={IsCaseSensitive:function(){return true;
},GetVisValue:function(){if(this.value.toString()==""){return this.PromptChar;
}return this.value;
},SetValue:function(a,b){this.value=a;
return true;
}};
Telerik.Web.UI.RadFreeMaskPart.registerClass("Telerik.Web.UI.RadFreeMaskPart",Telerik.Web.UI.RadMaskPart);
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadLiteralMaskPart=function(a){Telerik.Web.UI.RadLiteralMaskPart.initializeBase(this);
this.ch=a;
};
Telerik.Web.UI.RadLiteralMaskPart.prototype={GetVisValue:function(){return this.ch;
},GetLength:function(){if(Sys.Browser.agent==Sys.Browser.Firefox){return this.ch.length-(this.ch.split("\r\n").length-1);
}return this.ch.length;
},GetValue:function(){return"";
},IsCaseSensitive:function(){if(this.NextChunk!=null){return this.NextChunk.IsCaseSensitive();
}},SetValue:function(a,b){b-=this.offset;
return a==this.ch.charAt(b)||!a;
},CanHandle:function(a,b){b-=this.offset;
if(a==this.ch.charAt(b)){return true;
}if(!a){return true;
}if(this.NextChunk!=null){return this.NextChunk.CanHandle(a,b+this.GetLength());
}}};
Telerik.Web.UI.RadLiteralMaskPart.registerClass("Telerik.Web.UI.RadLiteralMaskPart",Telerik.Web.UI.RadMaskPart);
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadLowerMaskPart=function(){Telerik.Web.UI.RadLowerMaskPart.initializeBase(this);
};
Telerik.Web.UI.RadLowerMaskPart.prototype={CanHandle:function(a,b){if(!this.IsAlpha(a)){this.controller._OnChunkError(this,this.GetValue(),a);
return false;
}return true;
},GetVisValue:function(){if(this.value.toString()==""){return this.PromptChar;
}return this.value.toString();
},SetValue:function(a,b){if(a==""){this.value="";
return true;
}if(this.IsAlpha(a)){this.value=a.toLowerCase();
}else{this.controller._OnChunkError(this,this.GetValue(),a);
}return true;
}};
Telerik.Web.UI.RadLowerMaskPart.registerClass("Telerik.Web.UI.RadLowerMaskPart",Telerik.Web.UI.RadMaskPart);
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadNumericRangeMaskPart=function(a,c,d,b){Telerik.Web.UI.RadNumericRangeMaskPart.initializeBase(this);
this.upperLimit=c;
this.lowerLimit=a;
this.length=Math.max(this.lowerLimit.toString().length,this.upperLimit.toString().length);
this.leftAlign=d;
this.zeroFill=b;
this.minusIncluded=this.lowerLimit<0||this.upperLimit<0;
this.value=a;
this.FlipDirection=0;
};
Telerik.Web.UI.RadNumericRangeMaskPart.prototype={SetController:function(a){this.controller=a;
this.GetVisValue();
},IsCaseSensitive:function(){return true;
},CanHandle:function(a,b){if((a=="-"||a=="+")&&this.lowerLimit<0){return true;
}if(isNaN(parseInt(a))){this.controller._OnChunkError(this,this.GetValue(),a);
return false;
}return true;
},InsertAt:function(a,b){return this.visValue.substr(0,b)+a.toString()+this.visValue.substr(b+1,this.visValue.length);
},ReplacePromptChar:function(b){var a=this.leftAlign?"":"0";
while(b.indexOf(this.PromptChar)>-1){b=b.replace(this.PromptChar,a);
}return b;
},SetValue:function(a,b){if(a==""){a=0;
}if(isNaN(parseInt(a))&&a!="+"&&a!="-"){return true;
}b-=this.offset;
var c=this.InsertAt(a,b);
c=this.ReplacePromptChar(c);
if(c.indexOf("-")!=-1&&c.indexOf("-")>0){c=c.replace("-","0");
}if(isNaN(parseInt(c))){c=0;
}if(this.controller.get_roundNumericRanges()){c=Math.min(this.upperLimit,c);
c=Math.max(this.lowerLimit,c);
this.setInternalValue(c);
}else{if(c<=this.upperLimit&&c>=this.lowerLimit){this.setInternalValue(c);
this.GetVisValue();
}else{return false;
}}this.GetVisValue();
return true;
},setInternalValue:function(b){var a=this.value;
this.value=b;
this.controller._OnEnumChanged(this,a,b);
if(a>b){this.controller._OnMoveDown(this,a,b);
}else{if(a<b){this.controller._OnMoveUp(this,a,b);
}}this.FlipDirection=0;
},GetVisValue:function(){var a="";
var b=Math.abs(this.value).toString();
if(this.leftAlign){if(this.value<0){a+=this.PromptChar;
}a+=b;
while(a.length<this.length){a+=this.controller.get_promptChar();
}}else{var c=this.zeroFill?"0":this.controller.get_promptChar();
if(this.value<0){b="-"+b;
}while(a.length<this.length-b.length){a+=c;
}a+=b;
}this.visValue=a;
return a;
},GetLength:function(){return this.length;
},HandleKey:function(b){this.controller._calculateSelection();
var a=new Telerik.Web.UI.MaskedEventWrap(b,this.controller._textBoxElement);
if(a.IsDownArrow()){this.MoveDown();
this.controller._FixSelection(a);
return true;
}else{if(a.IsUpArrow()){this.MoveUp();
this.controller._FixSelection(a);
return true;
}}},MoveUp:function(){var a=this.value;
a++;
if(a>this.upperLimit){a=this.lowerLimit;
this.FlipDirection=1;
}this.setInternalValue(a);
this.controller._Visualise();
},MoveDown:function(){var a=this.value;
a--;
if(a<this.lowerLimit){a=this.upperLimit;
this.FlipDirection=-1;
}this.setInternalValue(a);
this.controller._Visualise();
},HandleWheel:function(d){var a=this.value;
var c;
if(d.rawEvent.wheelDelta){c=d.rawEvent.wheelDelta/120;
if(window.opera){c=-c;
}}else{if(d.rawEvent.detail){c=-d.rawEvent.detail/3;
}}a=parseInt(a)+c;
var b=new Telerik.Web.UI.MaskedEventWrap(d,this.controller._textBoxElement);
if(a<this.lowerLimit){a=this.upperLimit-(this.lowerLimit-a-1);
this.FlipDirection=-1;
}if(a>this.upperLimit){a=this.lowerLimit+(a-this.upperLimit-1);
this.FlipDirection=1;
}this.setInternalValue(a);
this.controller._Visualise();
this.controller._FixSelection(b);
return false;
}};
Telerik.Web.UI.RadNumericRangeMaskPart.registerClass("Telerik.Web.UI.RadNumericRangeMaskPart",Telerik.Web.UI.RadMaskPart);
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadUpperMaskPart=function(){Telerik.Web.UI.RadUpperMaskPart.initializeBase(this);
};
Telerik.Web.UI.RadUpperMaskPart.prototype={CanHandle:function(a,b){if(!this.IsAlpha(a)){this.controller._OnChunkError(this,this.GetValue(),a);
return false;
}return true;
},GetVisValue:function(){if(this.value.toString()==""){return this.PromptChar;
}return this.value.toString();
},SetValue:function(a,b){if(a==""){this.value="";
return true;
}if(this.IsAlpha(a)){this.value=a.toUpperCase();
}else{this.controller._OnChunkError(this,this.GetValue(),a);
}return true;
}};
Telerik.Web.UI.RadUpperMaskPart.registerClass("Telerik.Web.UI.RadUpperMaskPart",Telerik.Web.UI.RadMaskPart);
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.MaskedEventWrap=function(b,a){if(b){this.event=b.rawEvent;
}this._selectionStart=a.selectionStart;
this._selectionEnd=a.selectionEnd;
this.fieldValue=a.value;
};
Telerik.Web.UI.MaskedEventWrap.prototype={IsUpArrow:function(){return this.event.keyCode==38;
},IsDownArrow:function(){return this.event.keyCode==40;
}};
Telerik.Web.UI.MaskedEventWrap.registerClass("Telerik.Web.UI.MaskedEventWrap");
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadMaskedTextBox=function(a){Telerik.Web.UI.RadMaskedTextBox.initializeBase(this,[a]);
this._parts=[];
this._partIndex=[];
this._displayPartIndex=[];
this._value="";
this._lastState=null;
this._length=0;
this._displayLength=0;
this._internalValueUpdate=false;
this._projectedValue="";
this._isTextarea=false;
this._initialMasks=[];
this._initialDisplayMasks=[];
this._promptChar="_";
this._displayPromptChar="_";
this._displayFormatPosition=Telerik.Web.UI.DisplayFormatPosition.Left;
this._hideOnBlur=false;
this._resetCaretOnFocus=false;
this._roundNumericRanges=true;
this._allowEmptyEnumerations=false;
this._readOnly=false;
this._focusOnStartup=false;
this._onTextBoxMouseUpDelegate=null;
this._onTextBoxMouseDownDelegate=null;
this._onTextBoxPasteDelegate=null;
this._onTextBoxPropertyChangeDelegate=null;
this._onTextBoxInputDelegate=null;
this._onFormResetDelegate=null;
this._isInitialized=false;
this._originalValue="";
this.preventPostBackAfterBlur=false;
};
Telerik.Web.UI.RadMaskedTextBox.prototype={initialize:function(){Telerik.Web.UI.RadMaskedTextBox.callBaseMethod(this,"initialize");
if(this._focused){this._focusOnStartup=true;
}this._fixAbsolutePositioning();
this._setMask(this.get__initialMasks());
if(this.get__initialDisplayMasks().length){this._setDisplayMask(this.get__initialDisplayMasks());
}this._SetValue(this._textBoxElement.value);
this._Visualise();
this._textBoxElement._oldValue=this._textBoxElement.value;
this._isTextarea=this._textBoxElement.tagName.toLowerCase()=="textarea";
this._RecordInitialState();
this._isInitialized=true;
if(this._focusOnStartup){this._calculateSelection();
this._lastState=new Telerik.Web.UI.MaskedEventWrap(null,this._textBoxElement);
}},dispose:function(){if(this._onTextBoxMouseUpDelegate){$removeHandler(this._textBoxElement,"mouseup",this._onTextBoxMouseUpDelegate);
this._onTextBoxMouseUpDelegate=null;
}if(this._onTextBoxMouseDownDelegate){$removeHandler(this._textBoxElement,"mousedown",this._onTextBoxMouseDownDelegate);
this._onTextBoxMouseDownDelegate=null;
}if(this._onFormResetDelegate){if(this._textBoxElement.form){$removeHandler(this._textBoxElement.form,"reset",this._onFormResetDelegate);
}this._onFormResetDelegate=null;
}if(Sys.Browser.agent==Sys.Browser.InternetExplorer){if(this._onTextBoxPasteDelegate){$removeHandler(this._textBoxElement,"paste",this._onTextBoxPasteDelegate);
this._onTextBoxPasteDelegate=null;
}if(this._onTextBoxPropertyChangeDelegate){$removeHandler(this._textBoxElement,"propertychange",this._onTextBoxPropertyChangeDelegate);
this._onTextBoxPropertyChangeDelegate=null;
}}else{if(this._onTextBoxInputDelegate){$removeHandler(this._textBoxElement,"input",this._onTextBoxInputDelegate);
this._onTextBoxInputDelegate=null;
}}Telerik.Web.UI.RadMaskedTextBox.callBaseMethod(this,"dispose");
},isEmpty:function(){return this._value=="";
},resetCursor:function(){this.set_cursorPosition(0);
},inSelection:function(a){this._calculateSelection();
if(this._textBoxElement.selectionStart!=this._textBoxElement.selectionEnd){this._OnActivity(a);
return true;
}if(a.ctrlKey||a.altKey||Sys.Browser.agent==Sys.Browser.Safari){this._OnActivity(a);
return true;
}return false;
},updateDisplayValue:function(){if(this._isInitialized){if(this._focused){if((this.get_hideOnBlur()&&this.isEmpty())||this._displayParts){this._Visualise();
this._textBoxElement.select();
}if(this.get_resetCaretOnFocus()){this.resetCursor();
}}else{this._Visualise();
}}},updateHiddenValue:function(){return this._setHiddenValue(this.get_valueWithPromptAndLiterals());
},get_valueWithLiterals:function(){var a=[];
for(var b=0;
b<this._parts.length;
b++){a[b]=this._parts[b].ch||this._parts[b].GetValue();
}return a.join("");
},get_valueWithPromptAndLiterals:function(){return this._GetVisibleValues(this._parts);
},get_prompt:function(){var b=new RegExp(".","g");
var a=[];
for(var c=0;
c<this._parts.length;
c++){a[c]=this._parts[c].ch||this._parts[c].GetVisValue().replace(b,this.get_promptChar());
}return a.join("");
},get_displayValue:function(){var a=this._value;
while(a.length<this._displayLength){if(this.get_displayFormatPosition()){a=this.get_promptChar()+a;
}else{a+=this.get_promptChar();
}}this._UpdateDisplayPartsInRange(a,0,this._displayLength);
if(this._displayParts){return this._GetVisibleValues(this._displayParts);
}else{return this._GetVisibleValues(this._parts);
}},set_cursorPosition:function(b){if(!this._focused){return;
}this._calculateSelection();
if(Sys.Browser.agent==Sys.Browser.InternetExplorer){this._textBoxElement.select();
sel=document.selection.createRange();
var a=this._textBoxElement.value.substr(0,b).split("\r\n").length-1;
sel.move("character",b-a);
sel.select();
}else{this._textBoxElement.selectionStart=b;
this._textBoxElement.selectionEnd=b;
}},get_value:function(){var a=[];
for(var b=0;
b<this._parts.length;
b++){a[b]=this._parts[b].GetValue();
}return a.join("");
},set_value:function(a){this._SetValue(a);
if(this._ValueHasChanged()){this.raise_valueChanged();
if(this.get_autoPostBack()&&!this.preventPostBackAfterBlur){this.raisePostBackEvent();
}}},get_promptChar:function(){return this._promptChar;
},set_promptChar:function(a){if(this._promptChar!=a){this._promptChar=a;
this.raisePropertyChanged("PromptChar");
}},get_displayPromptChar:function(){return this._displayPromptChar;
},set_displayPromptChar:function(a){if(this._displayPromptChar!=a){this._displayPromptChar=a;
this.raisePropertyChanged("DisplayPromptChar");
}},get_displayPromptChar:function(){return this._displayPromptChar;
},set_displayPromptChar:function(a){if(this._displayPromptChar!=a){this._displayPromptChar=a;
this.raisePropertyChanged("DisplayPromptChar");
}},get_displayPromptChar:function(){return this._displayPromptChar;
},set_displayPromptChar:function(a){if(this._displayPromptChar!=a){this._displayPromptChar=a;
this.raisePropertyChanged("DisplayPromptChar");
}},get_displayFormatPosition:function(){return this._displayFormatPosition;
},set_displayFormatPosition:function(a){if(this._displayFormatPosition!=a){this._displayFormatPosition=a;
this.raisePropertyChanged("DisplayFormatPosition");
}},get_hideOnBlur:function(){return this._hideOnBlur;
},set_hideOnBlur:function(a){if(this._hideOnBlur!=a){this._hideOnBlur=a;
this.raisePropertyChanged("HideOnBlur");
}},get_resetCaretOnFocus:function(){return this._resetCaretOnFocus;
},set_resetCaretOnFocus:function(a){if(this._resetCaretOnFocus!=a){this._resetCaretOnFocus=a;
this.raisePropertyChanged("ResetCaretOnFocus");
}},get_roundNumericRanges:function(){return this._roundNumericRanges;
},set_roundNumericRanges:function(a){if(this._roundNumericRanges!=a){this._roundNumericRanges=a;
this.raisePropertyChanged("RoundNumericRanges");
}},get_allowEmptyEnumerations:function(){return this._allowEmptyEnumerations;
},set_allowEmptyEnumerations:function(a){if(this._allowEmptyEnumerations!=a){this._allowEmptyEnumerations=a;
this.raisePropertyChanged("AllowEmptyEnumerations");
}},get_readOnly:function(){return this._readOnly;
},set_readOnly:function(a){if(this._readOnly!=a){this._readOnly=a;
this.raisePropertyChanged("ReadOnly");
}},saveClientState:function(){return Telerik.Web.UI.RadMaskedTextBox.callBaseMethod(this,"saveClientState");
},_attachMouseEventHandlers:function(){Telerik.Web.UI.RadMaskedTextBox.callBaseMethod(this,"_attachMouseEventHandlers");
this._onTextBoxMouseDownDelegate=Function.createDelegate(this,this._onTextBoxMouseDownHandler);
if(!$telerik.isSafari){this._onTextBoxMouseUpDelegate=Function.createDelegate(this,this._onTextBoxMouseUpHandler);
$addHandler(this._textBoxElement,"mouseup",this._onTextBoxMouseUpDelegate);
}$addHandler(this._textBoxElement,"mousedown",this._onTextBoxMouseDownDelegate);
},_attachEventHandlers:function(){Telerik.Web.UI.RadMaskedTextBox.callBaseMethod(this,"_attachEventHandlers");
if(this._textBoxElement&&this._textBoxElement.form){this._onFormResetDelegate=Function.createDelegate(this,this._onFormResetHandler);
$addHandler(this._textBoxElement.form,"reset",this._onFormResetDelegate);
}if(Sys.Browser.agent==Sys.Browser.InternetExplorer){this._onTextBoxPasteDelegate=Function.createDelegate(this,this._onTextBoxPasteHandler);
this._onTextBoxPropertyChangeDelegate=Function.createDelegate(this,this._onTextBoxPropertyChangeHandler);
$addHandler(this._textBoxElement,"paste",this._onTextBoxPasteDelegate);
$addHandler(this._textBoxElement,"propertychange",this._onTextBoxPropertyChangeDelegate);
}else{this._onTextBoxInputDelegate=Function.createDelegate(this,this._onTextBoxInputHandler);
$addHandler(this._textBoxElement,"input",this._onTextBoxInputDelegate);
}if(Sys.Browser.agent==Sys.Browser.Opera){var b=this;
var a=function(){return b._ValueHandler({});
};
setInterval(a,10);
}},_SetValue:function(a){this._internalValueUpdate=true;
this._UpdatePartsInRange(a,0,this._length);
this._internalValueUpdate=false;
this._Visualise();
},_initializeHiddenElement:function(a){this._hiddenElement=$get(a+"_Value");
},_initializeValidationField:function(a){this._validationField=$get(a);
},_setValidationField:function(a){if(this.isEmpty()){this._validationField.value="";
}else{this._validationField.value=this.get_valueWithLiterals();
}},_getValidationField:function(a){return this._validationField;
},_onFormResetHandler:function(a){if(this._originalValue==null){this._originalValue="";
}this._setHiddenValue(this._originalValue);
this._SetValue(this._originalValue);
},_onTextBoxInputHandler:function(a){this._ValueHandler(a);
},_onMouseWheel:function(a){return this._OnMouseWheel(event);
},_onTextBoxPropertyChangeHandler:function(a){this._OnPropertyChange();
},_onTextBoxPasteHandler:function(b){if(this.get_readOnly()){return false;
}var a=this;
setTimeout(function(){a._FakeOnPropertyChange();
},1);
},_onTextBoxBlurHandler:function(a){this._focused=false;
this._hovered=false;
if(this._ValueHasChanged()){this.raise_valueChanged();
if(this.get_autoPostBack()){this.raisePostBackEvent();
this.preventPostBackAfterBlur=true;
}}this.raise_blur(Sys.EventArgs.Empty);
this.updateDisplayValue();
this.updateCssClass();
},_onTextBoxMouseUpHandler:function(a){this._FakeOnPropertyChange();
this._ValueHandler(a);
this._ActivityHandler(a);
if(($telerik.isSafari||$telerik.isFirefox)&&this._allowApplySelection){this._allowApplySelection=false;
this._updateSelectionOnFocus();
a.preventDefault();
a.stopPropagation();
}},_onTextBoxMouseDownHandler:function(a){this._FakeOnPropertyChange();
this._ActivityHandler(a);
},_onTextBoxFocusHandler:function(b){this._allowApplySelection=true;
this._focused=true;
this.updateDisplayValue();
this.updateCssClass();
this._updateSelectionOnFocus();
this._FakeOnPropertyChange();
this._ActivityHandler(b);
this.raise_focus(Sys.EventArgs.Empty);
if(($telerik.isSafari||$telerik.isFirefox)&&this.get_selectionOnFocus()!=Telerik.Web.UI.SelectionOnFocus.None&&this.get_selectionOnFocus()!=Telerik.Web.UI.SelectionOnFocus.SelectAll){var a=this;
window.setTimeout(function(){a._triggerDomEvent("mouseup",a._textBoxElement);
},1);
}},_onTextBoxKeyUpHandler:function(a){this._FakeOnPropertyChange();
},_OnActivity:function(a){this._calculateSelection();
this._lastState=new Telerik.Web.UI.MaskedEventWrap(a,this._textBoxElement);
},_OnPropertyChange:function(){if(this._internalValueUpdate){return;
}if(event.propertyName=="value"){var b=event;
var a=this;
var c=function(){a._ValueHandler(b);
};
this._calculateSelection();
if(this._textBoxElement.selectionStart>0||this._textBoxElement.selectionEnd>0){c();
}else{setTimeout(c,1);
}}},_onTextBoxMouseWheelHandler:function(b){if(this.get_readOnly()){return false;
}this._calculateSelection();
var a=this._partIndex[this._textBoxElement.selectionStart];
if(a==null){return true;
}return a.HandleWheel(b);
},_updateSelectionOnFocus:function(){switch(this.get_selectionOnFocus()){case 0:break;
case 1:var b=0;
var a;
for(a=0;
a<this._partIndex.length;
a++){if(!this._partIndex[a].ch){b=a;
break;
}}this.set_caretPosition(b);
break;
case 2:if(this._textBoxElement.value.length>0){this.set_caretPosition(this._textBoxElement.value.length);
}break;
case 3:this.selectAllText();
break;
default:this.set_caretPosition(0);
break;
}},_onTextBoxKeyDownHandler:function(f){if(f.keyCode==27&&!$telerik.isIE){var b=this;
window.setTimeout(function(){b.set_textBoxValue(b.get_editValue());
},0);
}this._FakeOnPropertyChange();
if(this.inSelection(f)){return true;
}var c=this._partIndex[this._textBoxElement.selectionStart];
if(this.get_readOnly()&&(f.keyCode==46||f.keyCode==8||f.keyCode==38||f.keyCode==40)){f.preventDefault();
return false;
}else{if(f.keyCode==13){return true;
}else{if(c==null&&f.keyCode!=8){return true;
}else{if(c!=null){if(c.HandleKey(f)){f.preventDefault();
return false;
}}}}}var d=this._textBoxElement.selectionEnd;
var a=false;
if((f.keyCode==46||f.keyCode==127)&&d<this._textBoxElement.value.length){c.SetValue("",this._textBoxElement.selectionStart);
d++;
a=true;
f.preventDefault();
}else{if(f.keyCode==8&&d){this._partIndex[this._textBoxElement.selectionStart-1].SetValue("",this._textBoxElement.selectionStart-1);
d--;
a=true;
f.preventDefault();
}}if(a){return this._UpdateAfterKeyHandled(f,d);
}this._OnActivity(f);
return true;
},_onTextBoxKeyPressHandler:function(f){if(this.get_readOnly()){f.preventDefault();
f.stopPropagation();
return false;
}var g=new Telerik.Web.UI.InputKeyPressEventArgs(f,f.charCode,String.fromCharCode(f.charCode));
this.raise_keyPress(g);
if(g.get_cancel()){f.stopPropagation();
f.preventDefault();
return false;
}if(this.inSelection(f)){return true;
}var a=this._partIndex[this._textBoxElement.selectionStart];
if(a==null){if(f.charCode==13){if(this._ValueHasChanged()){this.raise_valueChanged();
this.updateDisplayValue();
this.updateCssClass();
}if(this.get_autoPostBack()){this.raisePostBackEvent();
}return true;
}else{if(f.charCode>47){f.stopPropagation();
f.preventDefault();
}return false;
}}if(Sys.Browser.agent==Sys.Browser.Firefox||Sys.Browser.agent==Sys.Browser.Opera){if(f.charCode==8){f.preventDefault();
f.stopPropagation();
return false;
}if(f.charCode==9){return true;
}if(!f.rawEvent.which){this._OnActivity(f);
f.stopPropagation();
return true;
}}var d=this._textBoxElement.selectionEnd;
if(f.charCode==13){if(this._ValueHasChanged()){this.raise_valueChanged();
this.updateDisplayValue();
this.updateCssClass();
}if(this.get_autoPostBack()){this.raisePostBackEvent();
}return true;
}var c=String.fromCharCode(f.charCode);
if(a.CanHandle(c)){while(d<this._textBoxElement.value.length){if(this._partIndex[d].SetValue(c,d)){d++;
break;
}d++;
}}var b=this._UpdateAfterKeyHandled(f,d);
if(!b){f.preventDefault();
}f.stopPropagation();
return b;
},_OnEnumChanged:function(c,a,b){var d=new Telerik.Web.UI.MaskedTextBoxEventArgs(b,a,c);
this.raise_enumerationChanged(d);
},_OnMoveUp:function(c,a,b){var d=new Telerik.Web.UI.MaskedTextBoxEventArgs(b,a,c);
this.raise_moveUp(d);
},_OnMoveDown:function(c,a,b){var d=new Telerik.Web.UI.MaskedTextBoxEventArgs(b,a,c);
this.raise_moveDown(d);
},_OnValueChange:function(c,a,b){var d=new Telerik.Web.UI.MaskedTextBoxEventArgs(b,a,c);
this.raiseEvent("valueChanged",d);
},_OnChunkError:function(c,a,b){var d=new Telerik.Web.UI.MaskedTextBoxEventArgs(b,a,c);
this.raise_error(d);
},_fixAbsolutePositioning:function(){var b=this._textBoxElement;
if(b.previousSibling&&b.previousSibling.tagName.toLowerCase()=="label"&&b.style.position=="absolute"){b.style.position="static";
var a=b.parentNode;
a.style.position="absolute";
a.style.top=b.style.top;
a.style.left=b.style.left;
}},_RecordInitialState:function(){this.initialFieldValue=this._textBoxElement.value;
},_PartAt:function(a){return this._partIndex[a];
},_CreatePartCollection:function(e,c){var f;
var a=[];
var g=0;
for(var d=0;
d<e.length;
d++){f=e[d];
f.PromptChar=c;
f.SetController(this);
f.index=this._parts.length;
a[a.length]=f;
if(a.length>1){a[a.length-2].NextChunk=f;
}f.NextChunk=null;
var b=f.GetLength();
f.offset=g;
g+=b;
}return a;
},_setMask:function(b){this._parts=this._CreatePartCollection(b,this.get_promptChar());
for(var c=0;
c<this._parts.length;
c++){var d=this._parts[c].GetLength();
for(var a=this._length;
a<this._length+d;
a++){this._partIndex[a]=this._parts[c];
}this._length+=d;
}},_setDisplayMask:function(c){this._displayParts=this._CreatePartCollection(c,this.get_displayPromptChar());
for(var d=0;
d<this._displayParts.length;
d++){var a=this._displayParts[d];
var e=a.GetLength();
if(a.ch){continue;
}for(var b=this._displayLength;
b<this._displayLength+e;
b++){this._displayPartIndex[b]=this._displayParts[d];
}this._displayLength+=e;
}},_SafariSelectionFix:function(b){var a=this._StrCompare(this._lastState.fieldValue,b.fieldValue);
b._selectionStart=a[0];
b._selectionEnd=a[0];
this._lastState._selectionStart=a[1];
this._lastState._selectionEnd=a[2];
},_HandleValueChange:function(h){if(this.get_readOnly()){this._Visualise();
return false;
}if(this._lastState==null){return;
}var g,d;
if(!$telerik.isSafari2&&$telerik.isSafari){this._SafariSelectionFix(h);
}if(this._lastState.fieldValue.length>h.fieldValue.length){if(h._selectionStart==this._textBoxElement.value.length){this._partIndex[this._partIndex.length-1].SetValue("",this._partIndex.length-1);
}if(this._lastState._selectionEnd>h._selectionStart){g=this._lastState._selectionEnd;
while(g-->h._selectionStart){this._partIndex[g].SetValue("",g);
}}else{g=this._lastState._selectionEnd+1;
while(g-->h._selectionStart){this._partIndex[g].SetValue("",g);
h._selectionEnd++;
}}}var f=this._lastState._selectionStart;
var c=Math.min(h._selectionStart,this._length);
var b=h.fieldValue.substr(f,c-f);
var a=this._UpdatePartsInRange(b,f,c);
h._selectionEnd+=a;
this._FixSelection(h);
},_SetPartValues:function(k,f,e,d,h){var c;
var a=0;
var b=d;
var g=0;
e=e.toString();
while(a<h-d&&b<f){c=e.charAt(a);
if(c==this.get_promptChar()){c="";
}if(k[b].SetValue(c,b)){a++;
}else{g++;
}b++;
}return g;
},_UpdateDisplayPartsInRange:function(b,a,c){this._SetPartValues(this._displayPartIndex,this._displayLength,b,a,c);
},_UpdatePartsInRange:function(b,a,c){var d=this._SetPartValues(this._partIndex,this._length,b,a,c);
this._Visualise();
return d;
},_FixSelection:function(a){this.set_cursorPosition(a._selectionEnd);
},_GetVisibleValues:function(b){var a=[];
for(var c=0;
c<b.length;
c++){a[c]=b[c].GetVisValue();
}return a.join("");
},_Visualise:function(){var b=this.get_valueWithPromptAndLiterals();
var a=this.get_value();
this._internalValueUpdate=true;
this._Render(b);
this.updateCssClass();
this._value=a;
this.updateHiddenValue();
this._internalValueUpdate=false;
this._projectedValue=this._textBoxElement.value;
},_Render:function(a){this._isEmptyMessage=false;
if(!this._focused){if(this.get_hideOnBlur()&&this.isEmpty()){this._isEmptyMessage=true;
this.set_textBoxValue(this.get_emptyMessage());
}else{if(this._displayParts&&this._displayParts.length){this.set_textBoxValue(this.get_displayValue());
}else{this.set_textBoxValue(a);
}}}else{this.set_textBoxValue(a);
}},_getResetValue:function(){var a="";
var b=this._parts[0];
while(b.NextChunk){if(b.GetVisValue()==b.GetValue()){a+=b.PromptChar;
}else{a+=b.GetVisValue();
}b=b.NextChunk;
}return a;
},_ValueHasChanged:function(){return this._textBoxElement.value!=this._textBoxElement._oldValue;
},_FakeOnPropertyChange:function(){if(document.createEventObject){if(event){var a=document.createEventObject(event);
}else{var a=document.createEventObject();
}a.propertyName="value";
this._textBoxElement.fireEvent("onpropertychange",a);
}},_UpdateAfterKeyHandled:function(b,a){this._Visualise();
var c=new Telerik.Web.UI.MaskedEventWrap(b,this._textBoxElement);
c._selectionEnd=a;
this._FixSelection(c);
return false;
},_ValueHandler:function(b){if(this._internalValueUpdate){return true;
}if(!b){b=window.event;
}this._calculateSelection();
var a=new Telerik.Web.UI.MaskedEventWrap(b,this._textBoxElement);
if(a.fieldValue!=this._projectedValue){this._HandleValueChange(a);
}return true;
},_ActivityHandler:function(a){if(this._internalValueUpdate){return true;
}if(!a){a=window.event;
}this._OnActivity(a);
return true;
},_calculateSelection:function(){if((document.selection&&Sys.Browser.agent!=Sys.Browser.Opera)&&(typeof window.getSelection=="undefined")){var a;
try{a=document.selection.createRange();
}catch(c){return;
}if(a.parentElement()!=this._textBoxElement){return;
}var b=a.duplicate();
if(this._isTextarea){b.moveToElementText(this._textBoxElement);
}else{b.move("character",-this._textBoxElement.value.length);
}b.setEndPoint("EndToStart",a);
this._textBoxElement.selectionStart=b.text.length;
this._textBoxElement.selectionEnd=this._textBoxElement.selectionStart+a.text.length;
if(this._isTextarea){}}},_StrCompare:function(b,f){var d;
var e,c,a;
d=0;
while(b.charAt(d)==f.charAt(d)&&d<b.length){d++;
}c=d;
b=b.substr(c).split("").reverse().join("");
f=f.substr(c).split("").reverse().join("");
d=0;
while(b.charAt(d)==f.charAt(d)&&d<b.length){d++;
}e=c+f.length-d;
a=b.length-d+c;
return[e,c,a];
},get__initialMasks:function(){return this._initialMasks;
},set__initialMasks:function(a){this._initialMasks=a;
},get__initialDisplayMasks:function(){return this._initialDisplayMasks;
},set__initialDisplayMasks:function(a){this._initialDisplayMasks=a;
},raise_valueChanged:function(){this._triggerDomEvent("change",this._getValidationField());
var a=this._textBoxElement._oldValue;
this._textBoxElement._oldValue=this._textBoxElement.value;
this._OnValueChange(null,a,this._textBoxElement.value);
}};
Telerik.Web.UI.RadMaskedTextBox.registerClass("Telerik.Web.UI.RadMaskedTextBox",Telerik.Web.UI.RadInputControl);
